package com.xkdx.caipiao.presistence.versioninfo;

import java.util.ArrayList;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xkdx.caipiao.module.network.AbsModule;

public class VersionInfoModule extends AbsModule {
	public ArrayList<VersionInfoInfo> list;

	@Override
	public void parseData() throws Exception {
		try {
			backJson = (JSONArray) result;
			list = new ArrayList<VersionInfoInfo>();
			for (int i = 0; i < backJson.size(); i++) {
				jsonObj = (JSONObject) backJson.get(i);
				String sortOfAct = jsonObj.getString("Act");
				if (sortOfAct.equals("update")) {
					parseJifen(jsonObj.getJSONObject("DetailInfo"));
				}

			}
		} catch (Exception e) {
			throw e;
		}

	}

	private void parseJifen(JSONObject  jsonArray) throws Exception {
		try {
			VersionInfoInfo upInfo = new VersionInfoInfo();
			if(jsonArray.getString("isupdate").equals("false")){
				upInfo.setUrl("");
			}else{
				upInfo.setUrl(jsonArray.getString("url"));
			}
			list.add(upInfo);


		} catch (Exception e) {

			throw e;
		}
	}
}
